using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class PanelRegister
    {   
		public CButton BtnBack;
		public InputField InputUsername;
		public InputField InputPassword;
		public InputField InputPasswordConfirm;
		public InputField InputInviteCode;
		public CButton BtnSubmit;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			BtnBack = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			InputUsername = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputPassword = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputPasswordConfirm = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputInviteCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			BtnSubmit = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_invalid_passwd { get { return i18n.GetTextByKey("invalid_passwd"); } }
		public string I18N_two_passwd_not_same { get { return i18n.GetTextByKey("two_passwd_not_same"); } }
		public string I18N_register_success { get { return i18n.GetTextByKey("register_success"); } }
    }
}
